/*
题目地址:https://leetcode-cn.com/problems/palindrome-number/
题目标签:数学
*/

#include <limits.h>

class Solution {
   public:
    bool isPalindrome(int x) {
        int y = x;
        int z = 0;
        while (y > 0) {
            if (z <= INT_MAX / 10) {
                z = z * 10 + y % 10;
                y /= 10;
            } else {
                break;
            }
        }
        return x == z;
    }
};